<nz-modal [(nzVisible)]="isVisible" [nzWidth]="modalWidth" (nzOnCancel)="onBack()" [nzStyle]="{'top': '50px'}">
  <div *nzModalTitle>{{ title }}</div>
  <ng-container *nzModalContent>
    <form [formGroup]="departmentForm" (keydown.enter)="$event.preventDefault()">
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="enterpriseName" nzRequired>企业名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请选择企业名称'">
              <nz-input-group nzSearch [nzAddOnAfter]="enterpriseNameSuffixIconButton">
                <input nz-input formControlName="enterpriseName" placeholder="请选择企业名称" readonly />
              </nz-input-group>
              <ng-template #enterpriseNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findEnterprise()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="departmentName" nzRequired>部门名称</nz-form-label>
            <nz-form-control [nzErrorTip]="'请输入部门名称'">
              <input nz-input formControlName="departmentName" placeholder="请输入部门名称" maxlength="64"/>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="12">
          <nz-form-item>
            <nz-form-label [nzSpan]="6" nzFor="parentDepartmentName">上级部门名称</nz-form-label>
            <nz-form-control>
              <nz-input-group nzSearch [nzAddOnAfter]="parentDepartmentNameSuffixIconButton">
                <input nz-input formControlName="parentDepartmentName" placeholder="请选择上级部门名称" readonly />
              </nz-input-group>
              <ng-template #parentDepartmentNameSuffixIconButton>
                <button nz-button nzType="primary" nzSearch (click)="findDepartment()"><nz-icon nzType="search" /></button>
              </ng-template>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
      <nz-row [nzGutter]="10">
        <nz-col [nzSpan]="22">
          <nz-form-item>
            <nz-form-label [nzSpan]="3" nzFor="departmentDescription">部门描述</nz-form-label>
            <nz-form-control>
              <textarea nz-input formControlName="departmentDescription" placeholder="请输入部门描述" maxlength="65535"></textarea>
            </nz-form-control>
          </nz-form-item>
        </nz-col>
      </nz-row>
    </form>
  </ng-container>
  <div *nzModalFooter>
    <div class="form-button-container">
      <button nz-button nzType="primary" (click)="onSave()" [nzLoading]="saveLoading">保存</button>
      <button nz-button nzType="default" (click)="onReset()" [nzLoading]="saveLoading">重置</button>
      <button nz-button nzType="default" (click)="onBack()">关闭</button>
    </div>
  </div>
</nz-modal>
<enterprise-selector (enterpriseSelectedEvent)="handleEnterpriseSelectedEvent($event)"></enterprise-selector>
<department-selector (departmentSelectedEvent)="handleDepartmentSelectedEvent($event)"></department-selector>
